let test = '{%=hahaha%}';
let _left = '{%',
    _right = '%}';

console.log(test.replace(RegExp(_left + '=(.*?)' + _right, 'g'), ""));

